<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>培训门户</title>
    <link rel="stylesheet" href="/lims/layui/css/layui.css?20190817.1">
    <link rel="stylesheet" href="/lims/css/common.css">
    <link rel="stylesheet" href="/lims/css/pad/topTab.css?20190827.1">
    <link rel="stylesheet" href="/lims/lib/swiper/css/swiper.min.css?20190830.1">
    <script src="/lims/layui/layui.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/lims/js/pad/topTab.js?20190827.3"></script>
    <style>
        html,body{
            width:100%;
            height: 100%;
        }
        .container{
            width:80%;
            margin:0 auto;
            height:100%;
        }
        .layui-card {
            width:30%;
            float:left;
            margin-right:3%;
            overflow: auto;
            margin-top: 10px;
        }
        .layui-nav{
            background: #0479b2;
        }
        .layui-nav .layui-this {
            color: #fff;
        }
        .layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after{
            background-color: #ffaa00;
        }
        .list li{
            height:30px;
            line-height: 30px;
            padding-left:10px;
        }
        .list li a {
            margin-left: 5px;
            /*color:*/
        }
    </style>
</head>
<body>
<div class="container">
    <div class="wrap" style="width: 100%;">

    </div>
</div>
<script>
    $.ajax({
        url:'/newFilePub/getNewAllPrivateFile?sortId=0',
        type:'get',
        dataType:'json',
        success:function(res){
            var str='';
            if(res.flag){
                var data = res.datas;
                for(var i=0;i<data.length;i++){
                    str += ' <div class="layui-card" id="'+data[i].sortId+'">\n' +
                        '            <ul class="layui-nav">\n' +
                        '                <li class="layui-nav-item layui-this">'+data[i].sortName+'</li>\n' +
                        '            </ul>\n' +
                        '            <ul class="list"></ul>' +
                        '        </div>'
                }
                $('.wrap').html(str)

                $('.layui-card').each(function(i,v){
                    var id = $(this).attr('id');
                    $.ajax({
                        url:'/newFileContent/getContentById',
                        data:{
                            sortId: id,
                            page: 1,
                            pageSize: 10,
                            useFlag: false,
                            sortType: 5
                        },
                        type:'get',
                        success:function(ress){
                            var str2=''
                            if(ress.flag){
                                var datas = ress.object.contentList;
                                if(datas.length>0){
                                    for(var j=0;j<datas.length;j++){
                                        str2 +=' <li><span style="color:#fff;padding: 1px 5px;'+function(){
                                            if(j==0){
                                                return 'background:#ff4400'
                                            }else if(j==1){
                                                return 'background:#ff7700'
                                            }else if(j==2){
                                                return 'background:#ffaa00'
                                            }else{
                                                return 'background:#cccccc'
                                            }
                                        }()+'">'+(j+1)+'</span><a href="/newFilePub/fileDetail?contentId='+datas[j].contentId+'&sortId='+datas[j].sortId+'" target="_blank">'+datas[j].subject+'</a></li>'
                                    }
                                }else{
                                    str2 = ' <li>暂无数据</li>'
                                }
                                $(v).find('.list').html(str2)
                            }
                        }
                    })
                })
            }
        }
    })


</script>
</body>
</html>